<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php 
mysql_connect("localhost","root","root");
mysql_select_db("appdrivergame");
$username= isset($_POST['username'])?$_POST['username']:'';
$password= isset($_POST['password'])?$_POST['password']:'';

$strSQL ="SELECT * FROM admin where user='".mysql_real_escape_string($username)."'
AND pass='".mysql_real_escape_string($username)."'";
$qry = mysql_query($strSQL) or die('ไม่สามารถเชื่อมต่อฐานข้อมูลได้ Error:'.mysql_error());
$row = mysql_fetch_assoc($qry);

if(!$row)
{?>
	<script type="text/javascript">
window.alert("ชื่อผู้ใช้งาน หรือ รหัสผ่านไม่ถูกต้อง")
window.location.href = "index.html";
</script>
	<?   
	}
	else
	{
	?>
    <script type="text/javascript">
	window.location.href = "Admin/index_admin.php";
	</script>     
	<? }
	mysql_close();
 ?>
</body>
</html>